# -*- coding: utf-8 -*-

# Scrapy settings for mztest project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     http://doc.scrapy.org/en/latest/topics/settings.html
#     http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
#     http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html

BOT_NAME = 'mztest'

SPIDER_MODULES = ['mztest.spiders']
NEWSPIDER_MODULE = 'mztest.spiders'

# start MySQL database configure setting
MYSQL_HOST = '192.168.13.1'
MYSQL_DBNAME = 'mzdb'
MYSQL_USER = 'root'
MYSQL_PASSWD = 'sunsasi'
# end of MySQL database configure setting

# Crawl responsibly by identifying yourself (and your website) on the user-agent
# USER_AGENT = 'mztest (+http://www.yourdomain.com)'

# Configure maximum concurrent requests performed by Scrapy (default: 16)
# CONCURRENT_REQUESTS=32

# Configure a delay for requests for the same website (default: 0)
# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
# DOWNLOAD_DELAY=3
# The download delay setting will honor only one of:
# CONCURRENT_REQUESTS_PER_DOMAIN=16
# CONCURRENT_REQUESTS_PER_IP=16

# Disable cookies (enabled by default)
# COOKIES_ENABLED=False

# Disable Telnet Console (enabled by default)
# TELNETCONSOLE_ENABLED=False

# Override the default request headers:
# DEFAULT_REQUEST_HEADERS = {
#   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
#   'Accept-Language': 'en',
# }
DEFAULT_REQUEST_HEADERS = {
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Encoding': 'gzip, deflate, sdch',
    'Accept-Language': 'zh-CN,zh;q=0.8',
    'Cache-Control': 'max-age=0',
    'Connection': 'keep-alive',
    'Cookie': '___rl__test__cookies=1481021068160; visitor_type=old; 53gid2=10149986833014; visitor_type=new; 53gid0=10149986833014; 53gid1=10149986833014; 53uvid=1; onliner_zdfq72111642=0; gr_user_id=3924669a-b123-4344-b0b7-9c87ea8fd131; _zg=%7B%22uuid%22%3A%20%22158c78a5d0591-00f1b03758cef6-690b7746-15f900-158c78a5d061e6%22%2C%22sid%22%3A%201480937629.974%2C%22updated%22%3A%201480937987.124%2C%22info%22%3A%201480816483596%2C%22cuid%22%3A%20%2257745%22%7D; maiziedu=13y5xyno77r26j4cmrfk43bfb5ii4kwi; maiziuid=b8b75595cb428a19b2d73b94ab34c9f1; 53revisit=1481020385977; 53gid2=10149986833014; 53gid0=10149986833014; 53gid1=10149986833014; 53uvid=1; onliner_zdfq72111642=0; OUTFOX_SEARCH_USER_ID_NCOO=683889281.4489156; visitor_type=old; ___rl__test__cookies=1481021865220; _gat=1; 53kf_72111642_keyword=; kf_72111642_keyword_ok=1; Hm_lvt_e3879546912fd4b2d6e909e064d49262=1480816481,1480937630,1481020386; Hm_lpvt_e3879546912fd4b2d6e909e064d49262=1481023150; _ga=GA1.2.1243864177.1480816482; SERVERID=c0817a475a12489d2374d5a10350f451|1481023147|1481023122',
    'Host': 'm.maiziedu.com',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
}
# Enable or disable spider middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
# SPIDER_MIDDLEWARES = {
#    'mztest.middlewares.MyCustomSpiderMiddleware': 543,
# }

# Enable or disable downloader middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
# DOWNLOADER_MIDDLEWARES = {
#    'mztest.middlewares.MyCustomDownloaderMiddleware': 543,
# }

# Enable or disable extensions
# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
# EXTENSIONS = {
#    'scrapy.telnet.TelnetConsole': None,
# }

# Configure item pipelines
# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
# ITEM_PIPELINES = {
#    'mztest.pipelines.SomePipeline': 300,
# }
ITEM_PIPELINES = {
    'mztest.pipelines.MaiziJsonPipeline': 300,
    # 'maizi.pipelines.MaiziMysqlPipeline': 300,
}
# Enable and configure the AutoThrottle extension (disabled by default)
# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
# NOTE: AutoThrottle will honour the standard settings for concurrency and delay
AUTOTHROTTLE_ENABLED=True
# The initial download delay
# AUTOTHROTTLE_START_DELAY=5
# The maximum download delay to be set in case of high latencies
# AUTOTHROTTLE_MAX_DELAY=60
# Enable showing throttling stats for every response received:
# AUTOTHROTTLE_DEBUG=False

# Enable and configure HTTP caching (disabled by default)
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
# HTTPCACHE_ENABLED=True
# HTTPCACHE_EXPIRATION_SECS=0
# HTTPCACHE_DIR='httpcache'
# HTTPCACHE_IGNORE_HTTP_CODES=[]
# HTTPCACHE_STORAGE='scrapy.extensions.httpcache.FilesystemCacheStorage'
